#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
const int N = 2e5 + 10;
int a[N],b[N];
int main()
{
	int t;
	scanf("%d", &t);
	while (t--)
	{
		int n;
		scanf("%d", &n);
		for (int i = 1; i < n; i++)
			scanf("%d", &b[i]);
		a[1] = b[1];
		a[n] = b[n - 1];
		for (int i = 2; i < n; i++)
			a[i] = min(b[i-1], b[i]);

		for (int i = 1; i <= n; i++)
			printf("%d ", a[i]);
		printf("\n");
	}
	return 0;
}